define(
   [
      'dojo/_base/declare',
      'dojo/_base/lang',
      'dojo/html',
      'dojo/dom-construct',
      'dijit/_WidgetBase',
      'dijit/_TemplatedMixin',
      'dijit/ProgressBar',
      'dojo/text!./templates/ProgressBar.html'
   ],
   function(declare, lang, html, domConstruct, _WidgetBase, _TemplatedMixin, ProgressBar, template)
   {
      return declare("noBusinessBase/widgets/ProgressBar", [_WidgetBase, _TemplatedMixin],
      {
         //Path to the template
         templateString: template,
      
         widgetsInTemplate: true,
         baseClass: 'ProgressBar',
      
         constructor: function(args)
         {
            // Call Super
            dojo.safeMixin(this, args);
         },
         postscript: function(args)
         {
            // Called after constructors
            this.inherited(arguments);
         },
         postCreate: function()
         {
            // Run any parent postCreate processes - can be done at any point
            this.inherited(arguments);
            this.mTitleDiv = domConstruct.create('div', {innerHTML: this.Title}, this.mAttachPointForTitle);
            this.mProgressBar = new ProgressBar({style: "width: 100%"}, this.mAttachPointForProgressBar);
            this.mCountDiv = domConstruct.create('div', {innerHTML: this.Progress + '/' + this.Total}, this.mAttachPointForCount);
            this.update(this.Progress);
         },
         update: function(progress)
         {
            this.Progress = progress;
            this.mProgressBar.set('value', this.Progress / this.Total * 100);
            html.set(this.mCountDiv, this.Progress + '/' + this.Total); 
         }
      });
   }
);
